home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 21
/
CU Amiga Magazine's Super CD-ROM 21 (1998)(EMAP Images)(GB)[!][issue 1998-04].iso
/
CUCD
/
Magazine
/
C_Tutorial
/
Part-9
/
wb1
/
screen.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-10-27
|
1KB
|
48 lines
/* Open screen and setup GadTools stuff */
#include "screen.h"
#include<stdio.h>
#include<clib/intuition_protos.h>
#define MY_TITLE "Hello World Painter"
/* Global record of our screen */
struct Screen* screen = NULL;
int openScreen(UBYTE depth, UWORD width, UWORD height, ULONG displayid)
{
UWORD pens[] = { ~0 };
/* Try to open a new screen with requested properties */
/* (A parameter of zero will be ignored, so the default */
/* value will be used by the screen) */
if(screen = OpenScreenTags(NULL,
depth ? SA_Depth : TAG_IGNORE, depth,
width ? SA_Width : TAG_IGNORE, width,
height ? SA_Height : TAG_IGNORE, height,
displayid ? SA_DisplayID : TAG_IGNORE, displayid,
/* Enable 3D look by specifying SA_Pens */
SA_Pens, pens,
SA_Title, MY_TITLE,
TAG_DONE))
return TRUE;
else
printf("Error: could not create screen\n");
return FALSE;
}
void closeScreen()
{
if(screen)
{
CloseScreen(screen);
/* Set to NULL to indicate that it's been closed */
screen = NULL;
}
}
struct Screen* getScreen()
{
return screen;
}